package com.baitengsoft.patentapimonitor.api.controller;


import com.baitengsoft.patentapimonitor.api.entity.TokenEntity;
import com.baitengsoft.patentapimonitor.common.utils.Res;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

/**
 * API测试接口
 *
 * @author KennyGu
 * @date 2017-11-27 15:47
 */
@RestController
@RequestMapping("/api")
@Api(value = "API测试",description = "kenny测试用")
public class ApiTestController  extends AbstractController {

    /**
     * 获取用户信息
     */
    @ApiOperation(value = "测试获取用户aa")
    @RequestMapping(value="userInfo", method= RequestMethod.GET)
    public Res userInfo(){
        return Res.ok().put("user", "Nothing");
    }

    /**
     * 忽略Token验证测试
     */
    @ApiOperation(value = "忽略Token验证测试bb")
    @RequestMapping(value="notToken", method=RequestMethod.GET)
    public Res notToken()
    {

        return Res.ok().put("msg", "无需token也能访问。。。");
    }

    /**
     * 接收JSON数据
     */
    @PostMapping("jsonData")
    public Res jsonData(@RequestBody TokenEntity token){
        return Res.ok().put("user", getAdminUser()).put("token", token);
    }
}
